{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Scroll down to get to the interesting tables..."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Construct list of properties of widgets\n",
    "\n",
    "\"Properties\" here is one of:\n",
    "\n",
    "+ `keys`\n",
    "+ `traits()`\n",
    "+ `class_own_traits()`\n",
    "\n",
    "Common (i.e. uninteresting) properties are filtered out."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The dependency on astropy is for their Table. Replace it with pandas if you want..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import itertools\n",
    "from ipywidgets import *\n",
    "from IPython.display import display\n",
    "from traitlets import TraitError\n",
    "\n",
    "from astropy.table import Table, Column"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Function definitions"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Calculate \"interesting\" properties"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def properties(widget, omit=None, source=None):\n",
    "    \"\"\"\n",
    "    Return a list of widget properties for a widget instance, omitting\n",
    "    common properties.\n",
    "    \n",
    "    Parameters\n",
    "    ----------\n",
    "    \n",
    "    widget : ipywidgets.Widget instance\n",
    "        The widget for which the list of preoperties is desired.\n",
    "    omit : list, optional\n",
    "        List of properties to omit in the return value. Default is \n",
    "        ``['layout', 'style', 'msg_throttle']``, and for `source='traits'\n",
    "        is extended to add ``['keys', 'comm']``.\n",
    "    source : str, one of 'keys', 'traits', 'class_own_traits', 'style_keys' optional\n",
    "        Source of property list for widget. Default is ``'keys'``.\n",
    "    \"\"\"\n",
    "    if source is None:\n",
    "        source = 'keys'\n",
    "    valid_sources = ('keys', 'traits', 'class_own_traits', 'style_keys')\n",
    "    if source not in valid_sources:\n",
    "        raise ValueError('source must be one of {}'.format(', '.join(valid_sources)))\n",
    "    if omit is None:\n",
    "        omit = ['layout', 'style', 'msg_throttle']\n",
    "    if source == 'keys':\n",
    "        props = widget.keys\n",
    "    elif source == 'traits':\n",
    "        props = widget.traits()\n",
    "        omit.extend(['keys', 'comm'])\n",
    "    elif source == 'class_own_traits':\n",
    "        props = widget.class_own_traits()\n",
    "    elif source == 'style_keys':\n",
    "        props = widget.style.keys\n",
    "    props = [k for k in props if not k.startswith('_')]    \n",
    "    return [k for k in props if k not in omit]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Create a table (cross-tab style) for which properties are available for which widgets\n",
    "\n",
    "This is the only place astropy.table.Table is used, so delete if you want to."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def table_for_keys(keys, keys_info, source):\n",
    "    unique_keys = set()\n",
    "    for k in keys:\n",
    "        unique_keys.update(keys_info[k])\n",
    "    unique_keys = sorted(unique_keys)\n",
    "    string_it = lambda x: 'X' if x else ''\n",
    "    colnames = ['Property ({})'.format(source)] + keys\n",
    "\n",
    "    columns = [Column(name=colnames[0], data=unique_keys)]\n",
    "    for c in colnames[1:]:\n",
    "        column = Column(name=c, data=[string_it(k in key_dict[c]) for k in unique_keys])\n",
    "        columns.append(column)\n",
    "    return Table(columns)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## List of widget objects..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "widget_list = [\n",
    "    IntSlider,\n",
    "    FloatSlider,\n",
    "    IntRangeSlider,\n",
    "    FloatRangeSlider,\n",
    "    IntProgress,\n",
    "    FloatProgress,\n",
    "    BoundedIntText,\n",
    "    BoundedFloatText,\n",
    "    IntText,\n",
    "    FloatText,\n",
    "    ToggleButton,\n",
    "    Checkbox,\n",
    "    Valid,\n",
    "    Dropdown,\n",
    "    RadioButtons,\n",
    "    Select,\n",
    "    SelectionSlider,\n",
    "    SelectionRangeSlider,\n",
    "    ToggleButtons,\n",
    "    SelectMultiple,\n",
    "    Text,\n",
    "    Textarea,\n",
    "    Label,\n",
    "    HTML,\n",
    "    HTMLMath,\n",
    "    Image,\n",
    "    Button,\n",
    "    Play,\n",
    "    DatePicker,\n",
    "    ColorPicker,\n",
    "    Box,\n",
    "    HBox,\n",
    "    VBox,\n",
    "    Accordion,\n",
    "    Tab\n",
    "]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## ...and their names"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "names = [wd.__name__ for wd in widget_list]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Figure out the properties for each widget\n",
    "\n",
    "The `try`/`except` below is to catch a couple of classes that *require* that `options` be passed on intialization."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "property_source = 'keys'\n",
    "all_keys = []\n",
    "for widget_class in widget_list:\n",
    "    try:\n",
    "        keys = properties(widget_class(), source=property_source)\n",
    "    except TraitError as e:\n",
    "        keys = properties(widget_class(options=(2,10)), source=property_source)\n",
    "    finally:\n",
    "        all_keys.append(keys)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Probably should have used a dict from the beginning..."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "key_dict = {k: v for k, v in zip(names, all_keys)}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Define a few groups of widgets by widget interface type\n",
    "\n",
    "This makes for nicer (i.e. more compact and readable) tables later on."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "sliders = [k for k in key_dict.keys() if 'Slider' in k]\n",
    "buttons = [k for k in key_dict.keys() if 'Button' in k]\n",
    "containers = ['Box', 'VBox', 'HBox', 'Accordion', 'Tab']\n",
    "texts = [k for k in names if 'text' in k or 'Text' in k] + [k for k in names if 'HTML' in k] + ['Label']\n",
    "progress = [k for k in names if 'Progress' in k]\n",
    "selects = ['Dropdown', 'Select', 'SelectMultiple']\n",
    "all_so_far = sliders + buttons + texts + containers + progress + selects\n",
    "others = [k for k in names if k not in all_so_far]\n",
    "\n",
    "slider_keys = set()\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Tables of keys (synced properties)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Sliders"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "&lt;Table length=11&gt;\n",
       "<table id=\"table4587123320\" class=\"table-striped table-bordered table-condensed\">\n",
       "<thead><tr><th>Property (keys)</th><th>IntSlider</th><th>FloatSlider</th><th>IntRangeSlider</th><th>FloatRangeSlider</th><th>SelectionSlider</th><th>SelectionRangeSlider</th></tr></thead>\n",
       "<thead><tr><th>str17</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th></tr></thead>\n",
       "<tr><td>continuous_update</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>description</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>disabled</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>index</td><td></td><td></td><td></td><td></td><td>X</td><td>X</td></tr>\n",
       "<tr><td>max</td><td>X</td><td>X</td><td>X</td><td>X</td><td></td><td></td></tr>\n",
       "<tr><td>min</td><td>X</td><td>X</td><td>X</td><td>X</td><td></td><td></td></tr>\n",
       "<tr><td>orientation</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>readout</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>readout_format</td><td>X</td><td>X</td><td>X</td><td>X</td><td></td><td></td></tr>\n",
       "<tr><td>step</td><td>X</td><td>X</td><td>X</td><td>X</td><td></td><td></td></tr>\n",
       "<tr><td>value</td><td>X</td><td>X</td><td>X</td><td>X</td><td></td><td></td></tr>\n",
       "</table>"
      ],
      "text/plain": [
       "<Table length=11>\n",
       " Property (keys)  IntSlider FloatSlider ... SelectionSlider SelectionRangeSlider\n",
       "      str17          str1       str1    ...       str1              str1        \n",
       "----------------- --------- ----------- ... --------------- --------------------\n",
       "continuous_update         X           X ...               X                    X\n",
       "      description         X           X ...               X                    X\n",
       "         disabled         X           X ...               X                    X\n",
       "            index                       ...               X                    X\n",
       "              max         X           X ...                                     \n",
       "              min         X           X ...                                     \n",
       "      orientation         X           X ...               X                    X\n",
       "          readout         X           X ...               X                    X\n",
       "   readout_format         X           X ...                                     \n",
       "             step         X           X ...                                     \n",
       "            value         X           X ...                                     "
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table_for_keys(sliders, key_dict, source=property_source)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Buttons"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "&lt;Table length=9&gt;\n",
       "<table id=\"table4587035784\" class=\"table-striped table-bordered table-condensed\">\n",
       "<thead><tr><th>Property (keys)</th><th>ToggleButton</th><th>RadioButtons</th><th>ToggleButtons</th><th>Button</th></tr></thead>\n",
       "<thead><tr><th>str12</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th></tr></thead>\n",
       "<tr><td>button_style</td><td>X</td><td></td><td>X</td><td>X</td></tr>\n",
       "<tr><td>description</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>disabled</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>icon</td><td>X</td><td></td><td></td><td>X</td></tr>\n",
       "<tr><td>icons</td><td></td><td></td><td>X</td><td></td></tr>\n",
       "<tr><td>index</td><td></td><td>X</td><td>X</td><td></td></tr>\n",
       "<tr><td>tooltip</td><td>X</td><td></td><td></td><td>X</td></tr>\n",
       "<tr><td>tooltips</td><td></td><td></td><td>X</td><td></td></tr>\n",
       "<tr><td>value</td><td>X</td><td></td><td></td><td></td></tr>\n",
       "</table>"
      ],
      "text/plain": [
       "<Table length=9>\n",
       "Property (keys) ToggleButton RadioButtons ToggleButtons Button\n",
       "     str12          str1         str1          str1      str1 \n",
       "--------------- ------------ ------------ ------------- ------\n",
       "   button_style            X                          X      X\n",
       "    description            X            X             X      X\n",
       "       disabled            X            X             X      X\n",
       "           icon            X                                 X\n",
       "          icons                                       X       \n",
       "          index                         X             X       \n",
       "        tooltip            X                                 X\n",
       "       tooltips                                       X       \n",
       "          value            X                                  "
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table_for_keys(buttons, key_dict, source=property_source)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Containers"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "&lt;Table length=3&gt;\n",
       "<table id=\"table4587035336\" class=\"table-striped table-bordered table-condensed\">\n",
       "<thead><tr><th>Property (keys)</th><th>Box</th><th>VBox</th><th>HBox</th><th>Accordion</th><th>Tab</th></tr></thead>\n",
       "<thead><tr><th>str14</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th></tr></thead>\n",
       "<tr><td>box_style</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>children</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>selected_index</td><td></td><td></td><td></td><td>X</td><td>X</td></tr>\n",
       "</table>"
      ],
      "text/plain": [
       "<Table length=3>\n",
       "Property (keys) Box  VBox HBox Accordion Tab \n",
       "     str14      str1 str1 str1    str1   str1\n",
       "--------------- ---- ---- ---- --------- ----\n",
       "      box_style    X    X    X         X    X\n",
       "       children    X    X    X         X    X\n",
       " selected_index                        X    X"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table_for_keys(containers, key_dict, source=property_source)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Text"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "&lt;Table length=7&gt;\n",
       "<table id=\"table4587125784\" class=\"table-striped table-bordered table-condensed\">\n",
       "<thead><tr><th>Property (keys)</th><th>BoundedIntText</th><th>BoundedFloatText</th><th>IntText</th><th>FloatText</th><th>Text</th><th>Textarea</th><th>HTML</th><th>HTMLMath</th><th>Label</th></tr></thead>\n",
       "<thead><tr><th>str11</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th></tr></thead>\n",
       "<tr><td>description</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>disabled</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td></td><td></td><td></td></tr>\n",
       "<tr><td>max</td><td>X</td><td>X</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>\n",
       "<tr><td>min</td><td>X</td><td>X</td><td></td><td></td><td></td><td></td><td></td><td></td><td></td></tr>\n",
       "<tr><td>placeholder</td><td></td><td></td><td></td><td></td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>rows</td><td></td><td></td><td></td><td></td><td></td><td>X</td><td></td><td></td><td></td></tr>\n",
       "<tr><td>value</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "</table>"
      ],
      "text/plain": [
       "<Table length=7>\n",
       "Property (keys) BoundedIntText BoundedFloatText IntText ... HTML HTMLMath Label\n",
       "     str11           str1            str1         str1  ... str1   str1    str1\n",
       "--------------- -------------- ---------------- ------- ... ---- -------- -----\n",
       "    description              X                X       X ...    X        X     X\n",
       "       disabled              X                X       X ...                    \n",
       "            max              X                X         ...                    \n",
       "            min              X                X         ...                    \n",
       "    placeholder                                         ...    X        X     X\n",
       "           rows                                         ...                    \n",
       "          value              X                X       X ...    X        X     X"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table_for_keys(texts, key_dict, source=property_source)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Progress bars"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "&lt;Table length=6&gt;\n",
       "<table id=\"table4586953640\" class=\"table-striped table-bordered table-condensed\">\n",
       "<thead><tr><th>Property (keys)</th><th>IntProgress</th><th>FloatProgress</th></tr></thead>\n",
       "<thead><tr><th>str11</th><th>str1</th><th>str1</th></tr></thead>\n",
       "<tr><td>bar_style</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>description</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>max</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>min</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>orientation</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>value</td><td>X</td><td>X</td></tr>\n",
       "</table>"
      ],
      "text/plain": [
       "<Table length=6>\n",
       "Property (keys) IntProgress FloatProgress\n",
       "     str11          str1         str1    \n",
       "--------------- ----------- -------------\n",
       "      bar_style           X             X\n",
       "    description           X             X\n",
       "            max           X             X\n",
       "            min           X             X\n",
       "    orientation           X             X\n",
       "          value           X             X"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table_for_keys(progress, key_dict, source=property_source)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Select widgets"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "&lt;Table length=4&gt;\n",
       "<table id=\"table4587126680\" class=\"table-striped table-bordered table-condensed\">\n",
       "<thead><tr><th>Property (keys)</th><th>Dropdown</th><th>Select</th><th>SelectMultiple</th></tr></thead>\n",
       "<thead><tr><th>str11</th><th>str1</th><th>str1</th><th>str1</th></tr></thead>\n",
       "<tr><td>description</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>disabled</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>index</td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>rows</td><td></td><td>X</td><td>X</td></tr>\n",
       "</table>"
      ],
      "text/plain": [
       "<Table length=4>\n",
       "Property (keys) Dropdown Select SelectMultiple\n",
       "     str11        str1    str1       str1     \n",
       "--------------- -------- ------ --------------\n",
       "    description        X      X              X\n",
       "       disabled        X      X              X\n",
       "          index        X      X              X\n",
       "           rows               X              X"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table_for_keys(selects, key_dict, source=property_source)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Everything else"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "&lt;Table length=14&gt;\n",
       "<table id=\"table4586951960\" class=\"table-striped table-bordered table-condensed\">\n",
       "<thead><tr><th>Property (keys)</th><th>Checkbox</th><th>Valid</th><th>Image</th><th>Play</th><th>DatePicker</th><th>ColorPicker</th></tr></thead>\n",
       "<thead><tr><th>str11</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th><th>str1</th></tr></thead>\n",
       "<tr><td>concise</td><td></td><td></td><td></td><td></td><td></td><td>X</td></tr>\n",
       "<tr><td>description</td><td>X</td><td>X</td><td></td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>disabled</td><td>X</td><td>X</td><td></td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>format</td><td></td><td></td><td>X</td><td></td><td></td><td></td></tr>\n",
       "<tr><td>height</td><td></td><td></td><td>X</td><td></td><td></td><td></td></tr>\n",
       "<tr><td>indent</td><td>X</td><td></td><td></td><td></td><td></td><td></td></tr>\n",
       "<tr><td>interval</td><td></td><td></td><td></td><td>X</td><td></td><td></td></tr>\n",
       "<tr><td>max</td><td></td><td></td><td></td><td>X</td><td></td><td></td></tr>\n",
       "<tr><td>min</td><td></td><td></td><td></td><td>X</td><td></td><td></td></tr>\n",
       "<tr><td>readout</td><td></td><td>X</td><td></td><td></td><td></td><td></td></tr>\n",
       "<tr><td>show_repeat</td><td></td><td></td><td></td><td>X</td><td></td><td></td></tr>\n",
       "<tr><td>step</td><td></td><td></td><td></td><td>X</td><td></td><td></td></tr>\n",
       "<tr><td>value</td><td>X</td><td>X</td><td></td><td>X</td><td>X</td><td>X</td></tr>\n",
       "<tr><td>width</td><td></td><td></td><td>X</td><td></td><td></td><td></td></tr>\n",
       "</table>"
      ],
      "text/plain": [
       "<Table length=14>\n",
       "Property (keys) Checkbox Valid Image Play DatePicker ColorPicker\n",
       "     str11        str1    str1  str1 str1    str1        str1   \n",
       "--------------- -------- ----- ----- ---- ---------- -----------\n",
       "        concise                                                X\n",
       "    description        X     X          X          X           X\n",
       "       disabled        X     X          X          X           X\n",
       "         format                    X                            \n",
       "         height                    X                            \n",
       "         indent        X                                        \n",
       "       interval                         X                       \n",
       "            max                         X                       \n",
       "            min                         X                       \n",
       "        readout              X                                  \n",
       "    show_repeat                         X                       \n",
       "           step                         X                       \n",
       "          value        X     X          X          X           X\n",
       "          width                    X                            "
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "table_for_keys(others, key_dict, source=property_source)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Style keys"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "property_source = 'style_keys'\n",
    "style_keys = []\n",
    "for widget_class in widget_list:\n",
    "    try:\n",
    "        keys = properties(widget_class(), source=property_source)\n",
    "    except TraitError as e:\n",
    "        keys = properties(widget_class(options=(2,10)), source=property_source)\n",
    "    except AttributeError:\n",
    "        keys=''\n",
    "    finally:\n",
    "        style_keys.append(keys)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "IntSlider has style keys: description_width, handle_color\n",
      "FloatSlider has style keys: description_width, handle_color\n",
      "IntRangeSlider has style keys: description_width, handle_color\n",
      "FloatRangeSlider has style keys: description_width, handle_color\n",
      "IntProgress has style keys: bar_color, description_width\n",
      "FloatProgress has style keys: bar_color, description_width\n",
      "BoundedIntText has style keys: description_width\n",
      "BoundedFloatText has style keys: description_width\n",
      "IntText has style keys: description_width\n",
      "FloatText has style keys: description_width\n",
      "ToggleButton has style keys: description_width\n",
      "Checkbox has style keys: description_width\n",
      "Valid has style keys: description_width\n",
      "Dropdown has style keys: description_width\n",
      "RadioButtons has style keys: description_width\n",
      "Select has style keys: description_width\n",
      "SelectionSlider has style keys: description_width\n",
      "SelectionRangeSlider has style keys: description_width\n",
      "ToggleButtons has style keys: description_width\n",
      "SelectMultiple has style keys: description_width\n",
      "Text has style keys: description_width\n",
      "Textarea has style keys: description_width\n",
      "Label has style keys: description_width\n",
      "HTML has style keys: description_width\n",
      "HTMLMath has style keys: description_width\n",
      "Image has style keys: \n",
      "Button has style keys: button_color, font_weight\n",
      "Play has style keys: description_width\n",
      "DatePicker has style keys: description_width\n",
      "ColorPicker has style keys: description_width\n",
      "Box has style keys: \n",
      "HBox has style keys: \n",
      "VBox has style keys: \n",
      "Accordion has style keys: \n",
      "Tab has style keys: \n"
     ]
    }
   ],
   "source": [
    "for w, s in zip(names, style_keys):\n",
    "    print('{} has style keys: {}'.format(w, ', '.join(s)))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "widgets-tutorial",
   "language": "python",
   "name": "widgets-tutorial"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
